#ifndef __EKOS_KERNEL_INTR_H__
#define __EKOS_KERNEL_INTR_H__

int intr_init();

#define IDT_COUNT       256
#define ISR_COUNT       32

/* The system level function prototype of irq interrupt handler */
typedef int(*irq_handler_t)(struct trapframe_t*);
/* and for exception handler */
typedef void(*ex_handler_t)(struct trapframe_t*);

/* Register handler for responding interrupt */
void register_ex_handler(uint32_t n, ex_handler_t h);
void register_irq_handler(uint32_t irq, irq_handler_t h);

proc_id_t get_irq_signal(uint32_t irq);
void      set_irq_signal(uint32_t irq, proc_id_t notify_pid);

/* Use by intr.c, the func table for handling exception and irq
 * request */
extern ex_handler_t		ex_handlers[ISR_COUNT];
extern irq_handler_t	irq_handlers[IRQ_COUNT];
extern proc_id_t		irq_signal[IRQ_COUNT];
extern kpipe_t          *irq_pipes;

void enable_irq_line(int irq);
void disable_irq_line(int irq);

#endif
